from PyQt5.QtWidgets import (QWidget, QLabel, QVBoxLayout)
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QColor, QPaintEvent
from core.floatwidget import FloatWidget
from core.themecolor import ThemeColor

class AboutUS(FloatWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setup_ui()

    def setup_ui(self):
        self.setWindowTitle("关于作者")

        # Content label with poem
        about = QLabel(self)
        about.setText(
            "四海遨游不系舟，相逢陌路俱回眸。\n\n千峰过眼同舒卷，万水萦怀任去留。\n\n鸥鹭盟深终未负，烟霞癖老更何求？\n\n莫辞肝胆酬知己，且尽人间快意讴！")

        # Author information
        author = QLabel(self)
        author.setText("微信:ZhangXL1313")
        author.setAlignment(Qt.AlignHCenter)

        # Main layout
        lay = QVBoxLayout(self)
        lay.setContentsMargins(30, 30, 30, 30)  # Equivalent to setMargin(30)
        lay.addWidget(about)
        lay.addSpacing(30)
        lay.addWidget(author)

        self.setLayout(lay)

    def paintEvent(self, event: QPaintEvent):
        painter = QPainter(self)
        color = ThemeColor.baseColor()  # Assuming ThemeColor is available
        color.setAlphaF(0.6)
        painter.fillRect(event.rect(), color)